'use strict';

/**
 * @ngdoc function
 * @name webApp.controller:ReportCtrl
 * @description
 * # ReportCtrl
 * Controller of the webApp
 */
angular.module('webApp')
  .controller('reportContent', function ($scope,promiseReport,cookie,popBox) {
    promiseReport.reportData().then(function(data){
      $scope.reportTitles = data;
      $scope.reportId = function(id){
        cookie.setCookie('reportId',id);
      };
    });
    //收藏
    $scope.collection = function(id){
      if(cookie.getCookie('access_token') && id){
        promiseReport.stars(id).then(function(){
          popBox.showConfirm('提示','收藏成功');
        });
      }
      else{
        popBox.showConfirm('警告','请先登录！');
      }
    };
});
